﻿/*
#**************************************************************************
#  openSIS is a student information system for public and non-public 
#  schools from Open Solutions for Education, Inc. web: www.os4ed.com
#
#  openSIS is  web-based, open source, and comes packed with features that 
#  include student demographic info, scheduling, grade book, attendance, 
#  report cards, eligibility, transcripts, parent portal, 
#  student portal and more.   
#
#  Visit the openSIS web site at http://www.opensis.com to learn more.
#  If you have question regarding this system or the license, please send 
#  an email to info@os4ed.com.
#
#  This program is released under the terms of the GNU General Public License  
#  as  published by the Free Software Foundation, version 2 of the License. 
#  See license.txt.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
#**************************************************************************** 

*/

using System;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using OpenSIS.OpenSISWCFServiceReference;
using OpenSISStudentListControl;


namespace OpenSIS.Student
{
    public partial class EntryFormLayout : System.Web.UI.Page
    {

        private HtmlTableRow dTRow;
        private HtmlTableCell dTCell;
        private HtmlTableCell dTCell2;
        private HtmlTable dTAdd;
        private HtmlTableRow dTAddRow;
        private HtmlTableCell dTAddCell;


        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
              //PopulateStudent360Tree();
                PopulateCategoryTree();
                PopulateFieldsInPageLoad();
                mvFormLayout.ActiveViewIndex = 1;               
            }
              //PopulateSummaryFields();
        }

        protected void PopulateFieldsInPageLoad()
        {
            // tvStudent360.Nodes[1].Selected = true;
            tvCategoryList.Nodes[0].Selected = true;
            lblHeader.Text = "<div class='heading_bevelline'>" + tvCategoryList.SelectedNode.Text.ToString() + "</div>" + "<div class='clear_m'>" + " " + "</div>";
           // OpenSISWCFServiceStudentSetupClient SpClientStudentCatFld = new OpenSISWCFServiceStudentSetupClient();                         
            OpenSISWCFServiceStudentFormLayoutClient SpClientStudentCatFld = new OpenSISWCFServiceStudentFormLayoutClient();
            hdnSchoolId.Value = Session["SchoolID"].ToString();
            Session["CategoryID"] = Convert.ToInt32("1");
            hdnCatId.Value = "1";
            int SchoolId = Convert.ToInt32(Session["SchoolID"]);
            DataTable dt = SpClientStudentCatFld.GetFieldsByCategoryEntryFormLayout( SchoolId,Convert.ToInt32(hdnCatId.Value), Session["MLUICulture"].ToString());
            SpClientStudentCatFld.Close();
            rptrFields.DataSource = dt;
            rptrFields.DataBind();
        }           

        //public void PopulateStudent360Tree()
        //{
        //    try
        //    {

        //        tvStudent360.Nodes.Clear();


        //        TreeNode TreeNodeDashboard = new TreeNode();

        //        TreeNodeDashboard.Text = "Dashboard";
        //        TreeNodeDashboard.Value = Convert.ToString("0");
        //        TreeNodeDashboard.ImageUrl = "~/App_Themes/main/images/icon_dashboard.png";
        //        tvStudent360.Nodes.Add(TreeNodeDashboard);

        //        TreeNode TreeNodeGeneralInfo = new TreeNode();
        //        TreeNodeGeneralInfo.Text = "General Info";
        //        TreeNodeGeneralInfo.Value = Convert.ToString("1");
        //        TreeNodeGeneralInfo.ImageUrl = "~/App_Themes/main/images/icon_generalinfo.png";
        //        tvStudent360.Nodes.Add(TreeNodeGeneralInfo);

        //        TreeNode TreeNodeAttendance = new TreeNode();
        //        TreeNodeAttendance.Text = "Attendance";
        //        TreeNodeAttendance.Value = Convert.ToString("2");
        //        TreeNodeAttendance.ImageUrl = "~/App_Themes/main/images/icon_attendance.png";
        //        tvStudent360.Nodes.Add(TreeNodeAttendance);

        //        TreeNode TreeNodeSchedule = new TreeNode();
        //        TreeNodeSchedule.Text = "Schedule";
        //        TreeNodeSchedule.Value = Convert.ToString("3");
        //        TreeNodeSchedule.ImageUrl = "~/App_Themes/main/images/icon_schedule.png";
        //        tvStudent360.Nodes.Add(TreeNodeSchedule);

        //        TreeNode TreeNodeGrades = new TreeNode();
        //        TreeNodeGrades.Text = "Grades";
        //        TreeNodeGrades.Value = Convert.ToString("4");
        //        TreeNodeGrades.ImageUrl = "~/App_Themes/main/images/icon_grades.png";
        //        tvStudent360.Nodes.Add(TreeNodeGrades);

        //        TreeNode TreeNodeEligibility = new TreeNode();
        //        TreeNodeEligibility.Text = "Eligibility";
        //        TreeNodeEligibility.Value = Convert.ToString("5");
        //        TreeNodeEligibility.ImageUrl = "~/App_Themes/main/images/icon_eligibility.png";
        //        tvStudent360.Nodes.Add(TreeNodeEligibility);

        //        TreeNode TreeNodeDiscipline = new TreeNode();
        //        TreeNodeDiscipline.Text = "Discipline";
        //        TreeNodeDiscipline.Value = Convert.ToString("6");
        //        TreeNodeDiscipline.ImageUrl = "~/App_Themes/main/images/icon_discipline.png";
        //        tvStudent360.Nodes.Add(TreeNodeDiscipline);

        //        TreeNode TreeNodeBilling = new TreeNode();
        //        TreeNodeBilling.Text = "Billing";
        //        TreeNodeBilling.Value = Convert.ToString("7");
        //        TreeNodeBilling.ImageUrl = "~/App_Themes/main/images/icon_billing.png";
        //        tvStudent360.Nodes.Add(TreeNodeBilling);








        //        tvStudent360.ExpandAll();
        //    }
        //    catch { }

        //}
        //protected void tvStudent360_SelectedNodeChanged(object sender, EventArgs e)
        //{
        //    try
        //    {
        //        foreach (TreeNode tn in tvCategoryList.Nodes)
        //        {

        //            tn.Selected = false;
        //        }
        //        mvFormLayout.ActiveViewIndex = Convert.ToInt32(tvStudent360.SelectedNode.Value);
        //        if (Convert.ToInt32(tvStudent360.SelectedNode.Value) == 1)
        //        {
        //            EntryFormLayoutBL categoryfields = new EntryFormLayoutBL();

        //            ddlSchoolName = (DropDownList)Page.Master.FindControl("ddlSchoolName");

        //            categoryfields.CategoryId = 1;
        //            hdnCatId.Value = "1";
        //            ddlSchoolName = (DropDownList)Page.Master.FindControl("ddlSchoolName");
        //            categoryfields.SchoolId = Convert.ToInt32(ddlSchoolName.SelectedItem.Value);
        //            DataTable dt = categoryfields.GetFieldsByCategory();
        //            rptrFields.DataSource = dt;
        //            rptrFields.DataBind();
        //            tvCategoryList.Nodes[0].Selected = true;
        //            //foreach (TreeNode tn in tvCategoryList.Nodes)
        //            //{
        //            //    string t = tn.Value.Split(",".ToCharArray())[0];
        //            //    if (t == dt.Rows[3][11].ToString())
        //            //    {

        //            //        tn.Selected = true;

        //            //    }

        //            //}
        //            tvStudent360.Nodes[1].Selected = true;
        //            lblHeader.Text = "<div class='heading_bevelline'>" + tvCategoryList.SelectedNode.Text.ToString() + "</div>" + "<div class='clear_m'>" + " " + "</div>";


        //        }
        //        else
        //        {
        //            rptrFields.DataSource = null;
        //            rptrFields.DataBind();
        //        }
        //        phAllFieldHolder.Controls.Clear();
        //    }
        //    catch { }
        //}

        public void PopulateCategoryTree()
        {
            try
            {
                OpenSISWCFServiceStudentSetupClient SpClientStudentSetUp = new OpenSISWCFServiceStudentSetupClient();
                
                int SchoolId = Convert.ToInt32(Session["SchoolID"]);
                DataTable dt = SpClientStudentSetUp.GetSchoolSpecificCategory(SchoolId.ToString(), Session["MLUICulture"].ToString());
                SpClientStudentSetUp.Close();
                tvCategoryList.Nodes.Clear();
                string[,] CategoryData = new string[100, 4];
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    TreeNode TreeNodeCategory = new TreeNode();
                    CategoryData[i, 0] = dt.Rows[i]["Cat_Name"].ToString();
                    CategoryData[i, 1] = dt.Rows[i]["Cat_Id"].ToString();
                    TreeNodeCategory.Text = CategoryData[i, 0];
                    TreeNodeCategory.Value = CategoryData[i, 1];
                    tvCategoryList.Nodes.Add(TreeNodeCategory);
                    tvCategoryList.ExpandAll();
                }
            }
            catch { }
        }

        protected void tvCategoryList_SelectedNodeChanged(object sender, EventArgs e)
        {
            try
            {
                OpenSISWCFServiceStudentSetupClient categoryfields = new OpenSISWCFServiceStudentSetupClient();
                OpenSISWCFServiceStudentFormLayoutClient categoryfieldsformlayout = new OpenSISWCFServiceStudentFormLayoutClient();
                hdnSchoolId.Value = Session["SchoolID"].ToString();
                int CategoryId = Convert.ToInt32(tvCategoryList.SelectedNode.Value);
                hdnCatId.Value = tvCategoryList.SelectedNode.Value.ToString();
                int SchoolId = Convert.ToInt32(Session["SchoolID"]);
                DataTable dt = categoryfieldsformlayout.GetFieldsByCategoryEntryFormLayout(SchoolId, CategoryId, Session["MLUICulture"].ToString());
                categoryfields.Close();
                // tvStudent360.Nodes[1].Selected = true;
                //foreach (TreeNode tn in tvCategoryList.Nodes)
                //{
                //    string t = tn.Value.Split(",".ToCharArray())[0];
                //    if (t == dt.Rows[0][11].ToString())
                //    {
                //        tn.Selected = true;
                //    }
                //}
                if (tvCategoryList.SelectedNode.Value.ToString() == "3")
                {
                    rptrFields.DataSource = null;
                    rptrFields.DataBind();
                    lblHeader.Text = "";
                    try
                    {
                        HtmlTable dTable = new HtmlTable();
                        dTable.CellPadding = 0;
                        dTable.CellSpacing = 10;
                        dTable.Border = 0;
                        dTable.BorderColor = "#cccccc";
                        dTable.Width = "100%";
                        HtmlTable AddressTable = new HtmlTable();
                        AddressTable.CellPadding = 2;
                        AddressTable.CellSpacing = 0;
                        AddressTable.Border = 0;
                        AddressTable.BorderColor = "#cccccc";
                        AddressTable.Width = "100%";
                        int tRows;
                        int tCells = 2;
                        int tCellsmod = Convert.ToInt32(dt.Rows.Count % tCells);
                        int tCellsquotient = Convert.ToInt32(dt.Rows.Count / tCells);
                        if (tCellsmod != 0)
                        {
                            tCellsquotient = tCellsquotient + 1;
                            int j = dt.Rows.Count;
                            DataRow dr = dt.NewRow();
                            dt.Rows.Add(dr);
                        }
                        for (tRows = 0; tRows < tCellsquotient; tRows++)
                        {
                            tRows = 0;
                            if (dt.Rows.Count > 0 || dt.Rows.Count != 0)
                            {
                                HtmlTableRow dTRow = new HtmlTableRow();
                                //-----------------------------------------------------
                                for (tCells = 0; tCells < 2; tCells++)
                                {
                                    this.dTAdd = new HtmlTable();
                                    this.dTAdd.CellPadding = 2;
                                    this.dTAdd.CellSpacing = 0;
                                    this.dTAdd.Border = 0;
                                    //this.dTAdd.BorderColor = "#cccccc";
                                    this.dTCell = new HtmlTableCell();
                                    this.dTCell2 = new HtmlTableCell();
                                    dTCell2.Attributes.Add("class", "bevel_verline");
                                    dTCell.VAlign = "top";
                                    dTCell.Align = "left";
                                    //dTCell.Attributes.Add("class", "darkblue_content");
                                    // HtmlTableCell dTCell = new HtmlTableCell();
                                    if (dt.Rows[tRows]["FieldName"].ToString() != "")
                                    {
                                        OpenSISWCFServiceStudentSetupClient SPClientDAFC = new OpenSISWCFServiceStudentSetupClient();
                                        int FieldId = Convert.ToInt32(dt.Rows[tRows]["FieldId"]);
                                        int addressfieldcount = SPClientDAFC.CheckDefaultAddressFieldCount(FieldId);
                                        SPClientDAFC.Close();
                                        if (addressfieldcount > 0)
                                        {
                                            dTCell.InnerHtml = "<div class=heading_bevelline>" + dt.Rows[tRows]["FieldName"].ToString() + "</div><div class=clear_m></div>";
                                            OpenSISWCFServiceStudentSetupClient SPClientGAD = new OpenSISWCFServiceStudentSetupClient();
                                            DataTable dtaddressfields = categoryfieldsformlayout.GetAddressFieldsByFieldIdEntryFormLayout(SchoolId, FieldId, Session["MLUICulture"].ToString());
                                            SPClientGAD.Close();
                                            // DataRow dra = dtaddressfields.NewRow();
                                            //dra["FieldName"] = dt.Rows[tRows]["FieldName"].ToString();
                                            // dtaddressfields.Rows.InsertAt(dra,0);
                                            int AddressTableRows;
                                            int AddressTableCells = 1;
                                            int AddressTableCellsmod = Convert.ToInt32(dtaddressfields.Rows.Count % AddressTableCells);
                                            int AddressTableCellsquotient = Convert.ToInt32(dtaddressfields.Rows.Count / AddressTableCells);
                                            if (AddressTableCellsmod != 0)
                                            {
                                                AddressTableCellsquotient = AddressTableCellsquotient + 1;
                                                int j = dtaddressfields.Rows.Count;
                                                DataRow dradd = dtaddressfields.NewRow();
                                                dtaddressfields.Rows.Add(dradd);
                                            }
                                            for (AddressTableRows = 0; AddressTableRows < AddressTableCellsquotient; AddressTableRows++)
                                            {
                                                AddressTableRows = 0;
                                                if (dtaddressfields.Rows.Count > 0 || dtaddressfields.Rows.Count != 0)
                                                {
                                                    this.dTAddRow = new HtmlTableRow();
                                                    for (AddressTableCells = 0; AddressTableCells < 1; AddressTableCells++)
                                                    {

                                                        this.dTAddCell = new HtmlTableCell();
                                                        dTAddCell.Width = "49%";
                                                        dTAddCell.VAlign = "top";
                                                        HtmlTableCell dTAddCell1 = new HtmlTableCell();
                                                        dTAddCell1.Width = "1%";
                                                        dTAddCell1.VAlign = "top";
                                                        HtmlTableCell dTAddCell2 = new HtmlTableCell();
                                                        dTAddCell2.Width = "50%";
                                                        dTAddCell2.VAlign = "top";
                                                        dTAddCell.InnerHtml = dtaddressfields.Rows[AddressTableRows]["FieldName"].ToString();
                                                        if (dtaddressfields.Rows[AddressTableRows]["FieldType"].ToString() == "1")
                                                        {
                                                            dTAddCell1.InnerText = " : ";
                                                            TextBox txt = new TextBox();
                                                            txt.ID = "txt";
                                                            txt.CssClass = "textbox_date";
                                                            dTAddCell2.Controls.Add(txt);
                                                        }
                                                        if (dtaddressfields.Rows[AddressTableRows]["FieldType"].ToString() == "2")
                                                        {
                                                            dTAddCell1.InnerText = " : ";
                                                            CheckBoxList chk = new CheckBoxList();
                                                            chk.ID = "chk";
                                                            chk.RepeatDirection = RepeatDirection.Horizontal;
                                                            dTAddCell2.Controls.Add(chk);
                                                        }
                                                        if (dtaddressfields.Rows[AddressTableRows]["FieldType"].ToString() == "3")
                                                        {
                                                            dTAddCell1.InnerText = " : ";
                                                            RadioButtonList rdb = new RadioButtonList();
                                                            rdb.ID = "rdb";
                                                            rdb.RepeatDirection = RepeatDirection.Horizontal;
                                                            dTAddCell2.Controls.Add(rdb);
                                                        }
                                                        if (dtaddressfields.Rows[AddressTableRows]["FieldType"].ToString() == "4")
                                                        {
                                                            dTAddCell1.InnerText = " : ";
                                                            DropDownList ddl = new DropDownList();
                                                            ddl.ID = "ddl";
                                                            ddl.CssClass = "textbox_date";
                                                            if (dtaddressfields.Rows[AddressTableRows]["FieldId"].ToString() == "4" || dtaddressfields.Rows[AddressTableRows]["FieldId"].ToString() == "13" || dtaddressfields.Rows[AddressTableRows]["FieldId"].ToString() == "24" || dtaddressfields.Rows[AddressTableRows]["FieldId"].ToString() == "40")
                                                            {
                                                                StudentListControl SLC = new StudentListControl();
                                                                SLC.populateState(ref ddl);
                                                            }
                                                            dTAddCell2.Controls.Add(ddl);
                                                        }
                                                        if (dtaddressfields.Rows[AddressTableRows]["FieldType"].ToString() == "5")
                                                        {
                                                            dTAddCell1.InnerText = " : ";
                                                            Label lbl = new Label();
                                                            lbl.ID = "lbl";

                                                            dTAddCell2.Controls.Add(lbl);
                                                        }
                                                        dTAddRow.Controls.Add(dTAddCell);
                                                        dTAddRow.Controls.Add(dTAddCell1);
                                                        dTAddRow.Controls.Add(dTAddCell2);
                                                        dtaddressfields.Rows.RemoveAt(0);
                                                    }
                                                    AddressTableRows = 0;
                                                    dTAdd.Controls.Add(dTAddRow);
                                                }
                                                else
                                                {
                                                    break;
                                                }
                                            }
                                            dTCell.Controls.Add(dTAdd);
                                        }
                                    }
                                    //dTRow.Controls.Add(dTCell);
                                    dTRow.Cells.Add(dTCell);
                                    if (tCells == 0)
                                    {
                                        dTRow.Controls.Add(dTCell2);
                                    }
                                    dt.Rows.RemoveAt(0);
                                    tRows = 0;
                                }
                                //-----------------------------------------------------
                                dTable.Controls.Add(dTRow);
                            }
                            else
                            {
                                break;
                            }
                        }
                        phAllFieldHolder.Controls.Add(dTable);
                    }
                    catch (Exception ex)
                    {
                        string Ex = ex.ToString();
                    }
                }
                else
                {
                    lblHeader.Text = "<div class='heading_bevelline'>" + tvCategoryList.SelectedNode.Text.ToString() + "</div>" + "<div class='clear_m'>" + " " + "</div>";
                    rptrFields.DataSource = dt;
                    rptrFields.DataBind();
                }
                categoryfieldsformlayout.Close();
            }
            catch 
            
            { 
            
            }
            finally
            { 
            
          
            }
        }

        protected void rptrFields_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            try
            {
                StudentListControl vmlBL = new StudentListControl();
                HiddenField hdnFieldType = (HiddenField)e.Item.FindControl("hdnFieldType");
                HiddenField hdnFieldId = (HiddenField)e.Item.FindControl("hdnFieldId");
                HtmlControl maindiv = (HtmlControl)e.Item.FindControl("maindiv");
                HiddenField hdnDefCus = (HiddenField)e.Item.FindControl("hdnDefCus");
                if (hdnDefCus.Value.ToString().Trim() == "D")
                {
                    if (hdnFieldType.Value.ToString() == "1")
                    {
                        TextBox txt = new TextBox();
                        txt.ID = "txt";
                        txt.Width = 100;
                        maindiv.Controls.Add(txt);
                    }
                    if (hdnFieldType.Value.ToString() == "2")
                    {
                        CheckBoxList chk = new CheckBoxList();
                        chk.ID = "chk";
                        chk.RepeatDirection = RepeatDirection.Horizontal;
                        maindiv.Controls.Add(chk);
                    }
                    if (hdnFieldType.Value.ToString() == "3")
                    {
                        RadioButtonList rdb = new RadioButtonList();
                        rdb.ID = "rdb";
                        int FieldId = Convert.ToInt32(hdnFieldId.Value);
                        if (Convert.ToInt32(hdnFieldId.Value) == 10)
                        {
                           // vmlBL.PopulateGender(ref rdb);
                            vmlBL.PopulateGender(ref rdb);
                        }
                        rdb.RepeatDirection = RepeatDirection.Horizontal;
                        maindiv.Controls.Add(rdb);
                    }
                    if (hdnFieldType.Value.ToString() == "4")
                    {
                        DropDownList ddl = new DropDownList();
                        ddl.ID = "ddl";
                        ddl.CssClass = "textbox_date";
                        int FieldId = Convert.ToInt32(hdnFieldId.Value);
                        if (Convert.ToInt32(hdnFieldId.Value) == 11)//ETHNICITY
                        {
                            //********18/05/2010**********
                            vmlBL.populateEthnicity(ref ddl, Convert.ToInt32(Session["SchoolID"]));
                        }
                        if (Convert.ToInt32(hdnFieldId.Value) == 15 || Convert.ToInt32(hdnFieldId.Value) == 16)//LANGUAGE
                        {
                            vmlBL.populateLanguage(ref ddl);
                        }
                        if (Convert.ToInt32(hdnFieldId.Value) == 18)//COUNTRY
                        {
                            vmlBL.populateCountry(ref ddl);
                        }
                        if (Convert.ToInt32(hdnFieldId.Value) == 120)//START CONDITION
                        {
                            //vmlBL.populateCountry(ref ddl);
                            vmlBL.PopulateEnrollCdn(ref ddl);
                        }
                        maindiv.Controls.Add(ddl);
                    }
                    if (hdnFieldType.Value.ToString() == "5")
                    {
                        Label lbl = new Label();
                        lbl.ID = "lbl";
                        maindiv.Controls.Add(lbl);
                    }

                    //******************change 23/06/10*************
                    if (hdnFieldType.Value.ToString() == "6")
                    {
                        var control = (DatePicker.DatePicker)Page.LoadControl("~/DatePicker.ascx");

                        control.ID = "uc";

                        maindiv.Controls.Add(control);
                    }

                }
                else if (hdnDefCus.Value.ToString().Trim() == "C")
                {
                    if (hdnFieldType.Value.ToString() == "1")
                    {
                        TextBox txt = new TextBox();
                        txt.ID = "txt";
                        txt.Width = 100;
                        maindiv.Controls.Add(txt);
                    }
                    if (hdnFieldType.Value.ToString() == "2")
                    {
                        CheckBoxList chk = new CheckBoxList();
                        chk.ID = "chk";
                        int FieldId = Convert.ToInt32(hdnFieldId.Value);
                        vmlBL.populatedynamicrchk(ref chk, FieldId);
                        chk.RepeatDirection = RepeatDirection.Horizontal;
                        maindiv.Controls.Add(chk);
                    }
                    if (hdnFieldType.Value.ToString() == "3")
                    {
                        RadioButtonList rdb = new RadioButtonList();
                        rdb.ID = "rdb";
                        int FieldId = Convert.ToInt32(hdnFieldId.Value);
                        vmlBL.populatedynamicrbtn(ref rdb, FieldId);
                        rdb.RepeatDirection = RepeatDirection.Horizontal;
                        maindiv.Controls.Add(rdb);
                    }
                    if (hdnFieldType.Value.ToString() == "4")
                    {
                        DropDownList ddl = new DropDownList();
                        ddl.ID = "ddl";
                        int FieldId = Convert.ToInt32(hdnFieldId.Value);
                        vmlBL.populatedynamicddl(ref ddl, FieldId);
                        ddl.AutoPostBack = false;
                        maindiv.Controls.Add(ddl);
                    }
                    if (hdnFieldType.Value.ToString() == "5")
                    {
                        Label lbl = new Label();
                        lbl.ID = "lbl";
                        maindiv.Controls.Add(lbl);
                    }
                    //******************change 23/06/10*************
                    if (hdnFieldType.Value.ToString() == "6")
                    {
                        var control = (DatePicker.DatePicker)Page.LoadControl("~/DatePicker.ascx");

                        control.ID = "uc";

                        maindiv.Controls.Add(control);
                    }

                }
                //if (hdnDefCus.Value.ToString().Trim() == "D")
                //{
                //    if (Convert.ToInt32(hdnFieldId.Value) == 1 || Convert.ToInt32(hdnFieldId.Value) == 13 || Convert.ToInt32(hdnFieldId.Value) == 14 || Convert.ToInt32(hdnFieldId.Value) == 110 || Convert.ToInt32(hdnFieldId.Value) == 11 || Convert.ToInt32(hdnFieldId.Value) == 15)
                //    {
                //        e.Item.Visible = false;
                //    }
                //}
            }
            catch { }
        }

        //protected void PopulateSummaryFields()
        //{
        //    try
        //    {
        //        EntryFormLayoutBL summaryflds = new EntryFormLayoutBL();
        //        DataTable dt= summaryflds.GetSummaryFields();
        //        rptrSummary.DataSource = dt; ;
        //        rptrSummary.DataBind();

        //    }
        //    catch { }
        //}

        protected void rptrSummary_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            HiddenField hdnFieldType = (HiddenField)e.Item.FindControl("hdnFieldType");
            HiddenField hdnFieldId = (HiddenField)e.Item.FindControl("hdnFieldId");
            HtmlControl maindiv = (HtmlControl)e.Item.FindControl("maindiv");

            if (Convert.ToInt32(hdnFieldId.Value) == 1 || Convert.ToInt32(hdnFieldId.Value) == 110 || Convert.ToInt32(hdnFieldId.Value) == 11 || Convert.ToInt32(hdnFieldId.Value) == 15 || Convert.ToInt32(hdnFieldId.Value) == 13)
            {
                Label lbl = new Label();
                lbl.ID = "lbl";
                if (Convert.ToInt32(hdnFieldId.Value) == 1)
                {
                    lbl.Text = "ABC 9999999999";
                }
                else if (Convert.ToInt32(hdnFieldId.Value) == 13)
                {
                    lbl.Text = "99-99-9999 | 99 yrs 99 mo";
                }
                else
                {
                    lbl.Text = "XXXXXXX";
                }
                maindiv.Controls.Add(lbl);
            }

            //if (Convert.ToInt32(hdnFieldId.Value) == 13)
            //{
            //    tdColon.Visible = false;
            //}
            //if (hdnFieldType.Value.ToString() == "1")
            //{
            //    TextBox txt = new TextBox();
            //    txt.ID = "txt";
            //    txt.Width = 100;
            //    if (Convert.ToInt32(hdnFieldId.Value) != 13)
            //    {
            //        maindiv.Controls.Add(txt);
            //    }
            //}
            //if (hdnFieldType.Value.ToString() == "2")
            //{
            //    CheckBoxList chk = new CheckBoxList();
            //    chk.ID = "chk";
            //    chk.RepeatDirection = RepeatDirection.Horizontal;
            //    maindiv.Controls.Add(chk);
            //}
            //if (hdnFieldType.Value.ToString() == "3")
            //{
            //    RadioButtonList rdb = new RadioButtonList();
            //    rdb.ID = "rdb";
            //    rdb.RepeatDirection = RepeatDirection.Horizontal;
            //    maindiv.Controls.Add(rdb);
            //}
            //if (hdnFieldType.Value.ToString() == "4")
            //{
            //    DropDownList ddl = new DropDownList();
            //    ddl.ID = "ddl";
            //    ddl.Items.Add("Select");
            //    maindiv.Controls.Add(ddl);
            //}
            //if (hdnFieldType.Value.ToString() == "5")
            //{
            //    Label lbl = new Label();
            //    lbl.ID = "lbl";
            //    StudentBL stbl2 = new StudentBL();
            //    maindiv.Controls.Add(lbl);
            //}
        }

    }
}